#include<stdio.h>

int main()
{
	int i,n,sum=0,x;
	scanf("%d",&n);
	for(i=0;i<=n;i++)
	{
		x=i;
		while (x!=0)
		{
		sum+=x%10;
		x/=10;
	    }
    }
    printf("%d",sum);
    return 0;
}
